/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-07-11 08:26:06
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\Api.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, DelDataButton } from '../Common/options'
import { Flow, User } from '../Common/Conversion'

export const GetFlowUserList = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    const FlowData = await Flow()
    const PersonListData = await User()
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`getUserRelation${url}`],
        added: 'posUserRelationAddFlowUserRelation',
        // hideInSearch: true,
        options: [<AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />],
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'flowUuid',
                title: '流程',
                valueType: 'select',
                valueEnum: FlowData,
                multiple: true,
                rules: true,
                width: 200,
                hideInTable: true,
            },
            {
                dataIndex: 'tableName',
                title: '流程名称',
                valueType: 'select',
                valueEnum: FlowData,
                ellipsis: true,
                rules: true,
                width: 150,
                hideInAdded: true,
                hideInModify: true,
                hideInSearch: true,
            },
            {
                dataIndex: 'parentUserUuid',
                title: '上级人员',
                valueType: 'select',
                valueEnum: PersonListData,
                ellipsis: true,
                rules: true,
                width: 150,
                hideInAdded: true,
                hideInModify: true,
            },
            {
                dataIndex: 'userUuid',
                title: '下级人员',
                valueType: 'select',
                valueEnum: PersonListData,
                ellipsis: true,
                rules: true,
                width: 150,
                hideInAdded: true,
                hideInModify: true,
                hideInSearch: true,
            },

            {
                dataIndex: 'parentUserUuid',
                title: '上级人员',
                valueType: 'select',
                valueEnum: PersonListData,
                rules: true,
                width: 200,
                hideInSearch: true,
                hideInTable: true,
            },
            {
                dataIndex: 'userUuid',
                title: '下级人员',
                valueType: 'select',
                valueEnum: PersonListData,
                multiple: true,
                rules: true,
                width: 200,
                hideInSearch: true,
                hideInTable: true,
            },

            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 400,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url="UserRelation"
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
